@(user: securesocial.core.java.SocialUser ,auser: models.User, appointments: java.util.List[AppointmentHistory])

<script type="text/template" id="myfeed-template">
@import org.scala_tools.time.Imports._
@import format._
@import org.joda.time.Days
@import play.libs.Json.toJson
@if(null != auser && auser.userType == "D"){
	@for(appointment  <- appointments ){
		@if(Days.daysBetween(DateTime.now, new DateTime(appointment.dateOfAppointment)).getDays() >=0){
			<p><span class="patient">@appointment.patient.name</a></span> has scheduled an appointment 
					@if( Days.daysBetween(DateTime.now, new DateTime(appointment.dateOfAppointment)).getDays()==0){
						<span class="date">Today</span>. Please click <a class="docappointment"  href="#" appointmentid="@appointment.id" >here</a> to view.
					}else{
						on <span class="date">@DateTimeFormat.forPattern("MMMM d, yyyy").print(new DateTime(appointment.dateOfAppointment)) </span>. Please click <a class="docappointment"  href="#" appointmentid="@appointment.id" >here</a> to view.
					}	
				<span class="time">@DateTimeFormat.forPattern("KK:mm a").print(DateTimeFormat.forPattern("HH:mm").parseDateTime(appointment.appointmentTime))</span>
			</p>
		}else{
			@if(appointment.appointmentConfirmation =="N"){
				<p>You had an appointment with <span class="patient">@appointment.patient.name</a></span> on
						<span class="date">@DateTimeFormat.forPattern("MMMM d, yyyy").print(new DateTime(appointment.dateOfAppointment))</span>
					.</br> Please click <a href="#">here</a> to check your diagnosis.
					<span class="time">@DateTimeFormat.forPattern("KK:mm a").print(DateTimeFormat.forPattern("HH:mm").parseDateTime(appointment.appointmentTime))</span>
				</p>
			}else{
			<p>You missed an appointment with <span class="patient">@appointment.patient.name</a></span> on
						<span class="date">@DateTimeFormat.forPattern("MMMM d, yyyy").print(new DateTime(appointment.dateOfAppointment))</span>
					. 
					<span class="time">@DateTimeFormat.forPattern("KK:mm a").print(DateTimeFormat.forPattern("HH:mm").parseDateTime(appointment.appointmentTime))</span>
				</p>
			}
		
		}
	}

}else{
	@for(appointment  <- appointments ){
		@if(Days.daysBetween(DateTime.now, new DateTime(appointment.dateOfAppointment)).getDays() >=0){
			<p>You have an upcoming appointment 
					@if( Days.daysBetween(DateTime.now, new DateTime(appointment.dateOfAppointment)).getDays()==0){
						<span class="date">Today</span>.
					}else{
						on <span class="date">@DateTimeFormat.forPattern("MMMM d, yyyy").print(new DateTime(appointment.dateOfAppointment)) </span>.
					}	
				<span class="time">@DateTimeFormat.forPattern("KK:mm a").print(DateTimeFormat.forPattern("HH:mm").parseDateTime(appointment.appointmentTime))</span>
			</p>
		}else{
			@if(appointment.appointmentConfirmation =="N"){
				<p>You seem to have missed an appointment on 
						<span class="date">@DateTimeFormat.forPattern("MMMM d, yyyy").print(new DateTime(appointment.dateOfAppointment))</span>
					. Please click <a href="#">here</a> to reschedule.
					<span class="time">@DateTimeFormat.forPattern("KK:mm a").print(DateTimeFormat.forPattern("HH:mm").parseDateTime(appointment.appointmentTime))</span>
				</p>
			}else{
				<p>You had visited  <span class="doctor">Dr. @appointment.doctor.name</a></span> on
					<span class="date">@DateTimeFormat.forPattern("MMMM d, yyyy").print(new DateTime(appointment.dateOfAppointment))</span>.
					Click 
					<a href="#">here</a> 
					to view his diagnosis.
					<span class="time">@DateTimeFormat.forPattern("KK:mm a").print(DateTimeFormat.forPattern("HH:mm").parseDateTime(appointment.appointmentTime))</span>
				</p>
			}
		
		}
		
		
	}
}
</script>

<script type="text/javascript">

var jsonObj = @Html(toJson(appointments).toString());

 </script>   

@scripts = {    
	<script type='text/javascript' src="@routes.Assets.at("javascripts/jquery-ui-1.8.23.custom.min.js")"></script>
    <script type="text/javascript" src="@routes.Assets.at("javascripts/jquery.lightbox_me.js")"></script>
    <script type="text/javascript" src="@routes.Assets.at("javascripts/prettify.js")"></script>
    <script type="text/javascript" src="@routes.Assets.at("javascripts/jquery.slimscroll.min.js")"></script>
    <script type="text/javascript" src="@routes.Assets.at("javascripts/hovercard.min.js")"></script>
    <script type="text/javascript" src="@routes.Assets.at("javascripts/ckeditor/ckeditor.js")"></script>
     <script type="text/javascript" src="@routes.Assets.at("javascripts/newsfeedview.js")"></script>
     <script type="text/javascript" src="@routes.Assets.at("javascripts/collapsible.js")"></script>
 
}
@main(user,"Welcome "+ auser.name,scripts) {
       		  	<script>
            		@if(null != auser && auser.userType == "D"){
	    				$(".control").append('<a href="#"><img src="@routes.Assets.at("images/left_panel_login_doctor.png")"></a>');
	    				userType="D";
            		}else{
  						$(".control").append('<a href="#"><img src="@routes.Assets.at("images/left_panel_login_patient.png")"></a>');
  						userType="P";
            		}  
            		</script>
 			<div class="toppart">
        		<div class="mainpart">
	        		<div class="outershell">
          		@if(null != auser && auser.userType == "D"){	        		
	        			<h1>Your Appointments</h1>
	        	}else{
	        			<h1>Recent Activities</h1>
	        	}
					   <div id="recentactivities">
					   	
					   </div>
					</div>
					<div id="navright">
					  <h1>Latest News</h1>
					  <hr />
					  <div id="rightnewsdiv">
						  </div>
				</div>
        	</div>
			</div>


}


        		<input type="hidden" id="doctorId"/>
	            <div class="modal_window" id="modal_window">
	                <div class="modal_form" id="modal_form">
	                	<label><strong></strong></label>
	                	<input type="hidden" id="appointmenthospitalid" >
	                    <label><strong>Chief Complaint:</strong> <input id="appointmentdescription" class="sprited"/></label>
	                    <label ><strong>Date:</strong> <input id="appointmentdate" class="firstField smallText" disabled="disabled"/>
	                    <strong>Time:</strong> <input id="appointmenttime" class="smallText" disabled="disabled"/></label>
	                    <label><strong>History of present illness:</strong> <textarea class="ckeditor" name="appointmentcomments" id="appointmentcomments" class="spritedtextarea"></textarea></label>
	                    <div class="actions" id="actions">
							<span class="fc-button fc-button-today ui-state-default ui-corner-left ui-corner-right">
								<span class="fc-button-inner">
									<span id="AppmentSubmit" class="fc-button-content">Submit</span>
									<span class="fc-button-effect">
										<span></span>
									</span>
								</span>
							</span>
	                    </div>
	                </div>
	                <a  id="close_x" class="close close_x" href="#">close</a>
	            </div>

	            <div class="modal_window" id="modal_window_doc">
	                <div class="modal_form" id="modal_form_doc">
	                    <label><strong>Speciality:</strong>
	                    	<select id ="speciality" class="spritedselected">
	                    		<option value="Hematology">Hematology</option>
	                    	</select> 
	                    </label>
	                    <label><strong>Doctor:</strong>
	                    	<select id ="doctorname" class="spritedselected">
	                    		<option value="4">Dr. Vijay Ramanan</option>
	                    	</select> 
	                    </label>
	                    <div class="actions" id="actions">
							<span class="fc-button fc-button-today ui-state-default ui-corner-left ui-corner-right">
								<span class="fc-button-inner">
									<span id="continue" class="fc-button-content">Continue</span>
									<span class="fc-button-effect">
										<span></span>
									</span>
								</span>
							</span>
	                    </div>
	                </div>
	                <a  id="close_x" class="close close_x" href="#">close</a>
	            </div>
	           	<div class="modal_window" id="doc_appointment">
	                <div class="modal_form" id="modal_form_doc1">
	                	<label><strong></strong> </label>
	                	<fieldset id="patientcomplaint">
  							<legend>Patient Complaint</legend>	                
		                    <label><strong></strong> </label>
		                    <label><strong></strong> </label>
		                    
		                 </fieldset >
	                	 <fieldset id="pasthistory">
  							<legend>Patient History</legend>
		                    <label><strong></strong> </label>
		                    <label><strong></strong> </label>
		                    <label><strong></strong> </label>
		                 </fieldset>
		                 <fieldset id="investigations">
  							<legend>Investigations</legend>
  							<input type="text" id="investigationType">
		                 </fieldset>
		                 <fieldset id="treatment">
  							<legend>Treatment Given</legend>
		                 </fieldset>
		                 
							Physical Exam: <textarea class="ckeditor" cols="30" id="editor1" name="editor1" rows="10"></textarea>
	                    
	                    
	                    <div class="actions" id="actions">
							<span class="fc-button fc-button-today ui-state-default ui-corner-left ui-corner-right">
								<span class="fc-button-inner">
									<span id="AppmentSubmit" class="fc-button-content">Submit</span>
									<span class="fc-button-effect">
										<span></span>
									</span>
								</span>
							</span>
	                    </div>
	                </div>
	            </div>
